{% extends 'blog_article/base.html' %}
{% load blog_tag %}
{% block title %}my blog{% endblock %}
{% block content %}
    <h1>my blog</h1>
    {% if tag %}
        <h2>posts tagged with "{{ tag.name }}"</h2>
    {% endif %}
    {% for post in posts %}

        <h2><a href="{% url 'detail' post.id %}">{{ post.title }}</a></h2>
        <p class="tags">
        tags:
        {% for tag in post.tags.all %}
            <a href="{% url 'post_by_tag' tag.slug %}">
            {{ tag.name }}
            </a>
            {% if not forloop.last %},
            {% endif %}
        {% endfor %}
        
        </p>
        <p class="date">
        published{{ post.publish }} by {{ post.author }}
        </p>
        {{ post.body|my_markdown|truncatewords_html:30 }}
    {% endfor %}
    {% include 'blog_article/pagination.html' with page=posts %}
{% endblock %}